package 题目集.贡献法;

import java.math.BigInteger;
import java.util.Arrays;
import java.util.Scanner;

public class 整数小拼接 {
    /**
     * 排序，找到可以以自己为左部分拼接的位置。（从右侧枚举）
     */
    static long k;
    static int n;
    static int[] arr;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        BigInteger bigK = new BigInteger(sc.next());
        arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = sc.nextInt();
        }
        Arrays.sort(arr);

        int l = n - 1, r = n - 1;   //以当前位置为左部分的位置，以及为右部分的位置
        long res = 0;
        for (int i = 0; i < l; i++) {
            BigInteger cur = new BigInteger("" + arr[i] + arr[l]);
            while (l > i && cur.compareTo(bigK) > 0) {
                l--;
                cur = new BigInteger("" + arr[i] + arr[l]);
            }
            res+=l-i;
        }
        for (int i = 0; i < r; i++) {
            BigInteger cur = new BigInteger("" + arr[r] + arr[i]);
            while (r > i &&  cur.compareTo(bigK) > 0) {
                r--;
                cur = new BigInteger("" + arr[r] + arr[i]);
            }
            res+=r-i;
        }

        System.out.println(res);
    }
}
